<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\CustomerController;
use App\Http\Controllers\Api\ManufacturerController;
use App\Http\Controllers\Api\GoodsController;
use App\Http\Controllers\Api\WheatPriceController;
use App\Http\Controllers\Api\RestockController;
use App\Http\Controllers\Api\DeliveryController;
use App\Http\Controllers\Api\IndexController;
use App\Http\Controllers\Api\LoginController;
use App\Http\Controllers\Api\RetailOrderController;
use App\Http\Controllers\Api\AddressController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});
Route::group(['middleware' => 'apptoken'], function () {
    Route::post('/addCustomer', [CustomerController::class, 'addCustomer']);
    Route::get('/getCustomerList', [CustomerController::class, 'getCustomerList']);
    Route::get('/getCustomerInfo', [CustomerController::class, 'getCustomerInfo']);

    Route::post('/addManufacturer', [ManufacturerController::class, 'addManufacturer']);
    Route::get('/getManufacturerList', [ManufacturerController::class, 'getManufacturerList']);

    Route::post('/addGoods', [GoodsController::class, 'addGoods']);
    Route::get('/getGoodsList', [GoodsController::class, 'getGoodsList']);

    Route::post('/addWheatPrice', [WheatPriceController::class, 'addWheatPrice']);
    Route::get('/getWheatPriceList', [WheatPriceController::class, 'getWheatPriceList']);
    Route::get('/getWheatPriceNew', [WheatPriceController::class, 'getWheatPriceNew']);

    Route::post('/addRestock', [RestockController::class, 'addRestock']);
    Route::get('/getRestockList', [RestockController::class, 'getRestockList']);

    Route::post('/addDelivery', [DeliveryController::class, 'addDelivery']);
    Route::get('/getDeliveryList', [DeliveryController::class, 'getDeliveryList']);

    Route::get('/getRestockInfo', [IndexController::class, 'getRestockInfo']);

    Route::post('/addRetailOrder', [RetailOrderController::class, 'addRetailOrder']);
    Route::get('/getRetailOrderList', [RetailOrderController::class, 'getRetailOrderList']);
    Route::get('/getRetailOrderInfo', [RetailOrderController::class, 'getRetailOrderInfo']);
});

Route::post('/login', [LoginController::class, 'login']);
Route::get('/getUserInfoByToken', [LoginController::class, 'getUserInfoByToken']);
Route::get('/getCounties', [AddressController::class, 'getCounties']);
Route::get('/getCities', [AddressController::class, 'getCities']);
Route::get('/getDistricts', [AddressController::class, 'getDistricts']);

